import java.io.*;

public class ReadData{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int x = 0;
        do {
            System.out.println("Enter a choice, which method "
                + "\ndo you want to perform (1 - Write data into a file; "
                + "2 - Read data from a file)?");
            x = scan.nextInt();
        } while(x != 1 || x != 2);
        
        File file = new File("some.txt");
        try {
            PrintWriter output = new PrintWriter(file);
            output.println("This is a test file...");
            output.println(file.getAbsolutePath());
        } catch (Exception ex) {}
    }
}